HEIG-VD
Formations » Bachelor » Formation à plein temps » IT Administration (AIT)

Lab 01 - Linux backup

Pedagogical objectives

Prerequisites

This lab requires an installation of Ubuntu 14.04 LTS. You can use the virtual machine you created for the ADS course last semester.

Task 1: Prepare the backup disk

In this task you will use your Linux VM to prepare an external disk that will hold backup data. It is recommended you use a USB stick that you can erase completely. For the purposes of this lab the USB stick behaves like any external disk, and we will call it a disk in the following.

If you do not have a USB stick available use your virtualization software to create a virtual disk and attach it to the Linux VM. You may have to shut down the VM before you can add a new disk. Do that only after you have done the first step below.

  1. Before plugging the disk in examine the special files in the /dev directory that represent hard disks. List all files called

    • /dev/hd*
    • /dev/sd*

    Which disks and which partitions on these disks are visible?

    Which partitions are mounted? Use the command mount without parameters to find out.

  2. Attach the disk to your computer.

    Consult again the special files in /dev. Which new files appeared? These represent the disk and its partitions you just attached.

  3. Create a partition table on the disk and create two partitions of equal size using the parted tool.

    • Invoke parted with superuser privileges.

    • Invoke parted with a single parameter which is the special file representing the disk. Be careful not to confuse the special file for the disk (ending in a letter) and for the partitions (ending in a number).

    • Display the existing partitions with the print command. If the disk is completely blank you will get an error message about a missing disk label.

    • Use the mktable command to create a partition table (overwriting any existing one). It should have MBR layout (i.e. label type msdos).

    • Display the free space with the command print free (roughly the size of the disk minus some overhead). Write the value down.

    • Use the mkpart command to create the partitions.

      • The first partition will
        • be a primary partition
        • have a file system type of fat32
        • start at 0
        • end at half the free space.
      • The second partition will
        • be a primary partition
        • have a file system type of ext4
        • start at half the free space
        • end at the free space.
    • Quit parted and verify that there are two special files in /dev that correspond to the two partitions.

    You can consult Gentoo Linux Documentation -- Preparing the Disks as a reference on how to use parted.

  4. Format the two partitions using the mkfs command.

    • The first partition has the file system type vfat:

      sudo mkfs -t vfat /dev/xxxx
      
    • The second partition has the file system type ext4.

      sudo mkfs -t ext4 /dev/xxxx
      
  5. Create two empty directories in the /mnt directory as mount points, called backup1 and backup2. Mount the newly created file systems in these directories.

  6. How much free space is available on these filesystems? Use the df command with the -h option to find out.

Task 2: Perform backups using tar and zip

In this task you will perform different backup tasks. For each write a quick reference that you would consult as a system administrator when you have forgotten the exact invocation of the command. Do this using the tar command and then using the zip command.

The backup tasks are the following:

Task 3: Backup of file metadata

In this task you will examine how well the backup commands preserve file metadata. Consult the man pages and perform tests using tar and zip and examine whether you can restore:

In the lab report describe the tests you did and their results.

Task 4: Symbolic and hard links

In this task you will examine whether the backup commands preserve symbolic and hard links. Consult the man pages and perform tests using tar and zip. In the lab report describe the tests you did and their results.

Lab deliverables

Write your lab report in plain text (.txt) or a word processor format (ODF, Word), or PDF. Plain text is preferred.

Put the report into the shared folder at \\eistore1.einet.ad.eivd.ch\cours\tic\MGF\AIT\Rendus. Organize your submissions in folders like so:

Lab due date

Deliver your results at the latest 15 minutes before the start of the next lesson.